package com.demo.web.admin.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;

public abstract class BaseController {
	
	@Autowired
	public HttpServletRequest request;
	
	@Autowired
	public HttpServletResponse response;
	
	public String getRemoteIP(){
		String ip = "127.0.0.1";
		ip = request.getHeader("X-Real-IP");
		if(StringUtils.isNotEmpty(ip)){
			return ip;
		}
		ip = request.getRemoteAddr();
		return ip;
	}
	
}
